package com.usian.article.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.usian.article.mapper.ArticleMapper;
import com.usian.article.service.ArticleService;
import com.usian.model.article.pojos.ApAuthor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, ApAuthor> implements ArticleService {
    @Override
    public ApAuthor findByUserId(Integer id) {
        List<ApAuthor> list = list(Wrappers.<ApAuthor>lambdaQuery().eq(ApAuthor::getUserId,id));
        if(list!=null &&!list.isEmpty()){
            return list.get(0);
        }
        return null;
    }
}
